<?php

/**
 * Prestamos form base class.
 *
 * @method Prestamos getObject() Returns the current form's model object
 *
 * @package    sbweb3
 * @subpackage form
 * @author     Pablo Andrés Díaz
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BasePrestamosForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'idprestamo'    => new sfWidgetFormInputHidden(),
      'biblioteca'    => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Biblioteca'), 'add_empty' => true)),
      'no_adqui'      => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Ejemplares'), 'add_empty' => true)),
      'no_cuenta'     => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Usuarios'), 'add_empty' => true)),
      'titulo'        => new sfWidgetFormInputText(),
      'autor'         => new sfWidgetFormInputText(),
      'clasificacion' => new sfWidgetFormInputText(),
      'fecha_salida'  => new sfWidgetFormDateTime(),
      'fecha_entrega' => new sfWidgetFormDateTime(),
      'tipo_prestamo' => new sfWidgetFormInputText(),
      'created_at'    => new sfWidgetFormDateTime(),
      'updated_at'    => new sfWidgetFormDateTime(),
    ));

    $this->setValidators(array(
      'idprestamo'    => new sfValidatorChoice(array('choices' => array($this->getObject()->get('idprestamo')), 'empty_value' => $this->getObject()->get('idprestamo'), 'required' => false)),
      'biblioteca'    => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Biblioteca'), 'required' => false)),
      'no_adqui'      => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Ejemplares'), 'required' => false)),
      'no_cuenta'     => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Usuarios'), 'required' => false)),
      'titulo'        => new sfValidatorString(array('max_length' => 60, 'required' => false)),
      'autor'         => new sfValidatorString(array('max_length' => 50, 'required' => false)),
      'clasificacion' => new sfValidatorString(array('max_length' => 50, 'required' => false)),
      'fecha_salida'  => new sfValidatorDateTime(array('required' => false)),
      'fecha_entrega' => new sfValidatorDateTime(array('required' => false)),
      'tipo_prestamo' => new sfValidatorString(array('max_length' => 4, 'required' => false)),
      'created_at'    => new sfValidatorDateTime(),
      'updated_at'    => new sfValidatorDateTime(),
    ));

    $this->widgetSchema->setNameFormat('prestamos[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Prestamos';
  }

}
